<template>
	<view class="container">
		<u-navbar :border-bottom="false" title="通知详情" title-color="#fff" back-icon-color="#fff"></u-navbar>
	  <view class="noticeTop">
			<view class="noticeTit">{{info.name}}</view>
			<view class="noticeInfo">
				<view class="noticeTime"><my-icon name="time"></my-icon><text>发布时间：{{info.createtime}}</text></view>
				<view class="noticeName" v-if="info.stuname"><my-icon name="ren"></my-icon><text>通知学生：{{noticePeo}}等{{info.counts}}人</text></view>
			  <view class="noticeRead" @click="goLink()"><text class="org">{{info.unreadcount}}</text>人未读 <my-icon name="bd-next"></my-icon></view>
			</view>
			<view class="noticeCon">{{info.content}}</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				noticeid:'',
				info:{}
			}
		},
		onLoad(option){
			this.noticeid=option.noticeid
			this.init()
		},
		computed:{
			noticePeo(){
				let arr=this.info.stuname.split( ',' )
				return arr[0]
			}
		},
		methods: {
			init(){
				return this.getInfo();
			},
			goLink(){
				uni.navigateTo({
					url:`./noticeRead?noticeid=${this.noticeid}`
				})
			},
			getInfo(){
				return new Promise((resolve, reject) => {
					  this.request
						.get('/app/teacher/notice/noticeDetail',{noticeId:this.noticeid})
						.then(res=>{
							this.info=res;
							// this.list=res
							resolve();
						})
				});
			}
		}
	}
</script>

<style lang="scss" scoped>
	.container{ padding:60upx 30upx}
	.noticeRead{
		color: #A6A6A6;
		font-size: 26upx;
		position: absolute;
		right: 0;
		bottom: 20upx;
		.org{
			color: #F99D2E;
		}
		.iconfont{
			margin-left: 16upx;
			font-size: 28upx;
			margin-right: 0!important;
		}
	}
	.noticeTop{
		.noticeTit{color: #363940; font-size:32upx;font-weight: 600;}
		.noticeInfo{
			padding: 20upx 0;
			position: relative;
		}
		.noticeInfo>view{
			display: flex;
			justify-content: start;
			align-items: center;
			color: #A6A6A6;
			font-size: 26upx;
			height: 50upx;
			.iconfont{
				margin-right: 16upx;
				font-size: 28upx;
			}
		}
	}
	.noticeCon{
		color: #363940;
		font-size: 30upx;
		margin-top: 30upx;
	}
</style>
